﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace DARE
{
    public class CContainerLineData : CWidgetData
    {
        public List<long> allowedTypes;
        public bool conserveAspect;
        public CHudTextureData elementsTexture;
        public Vector2 itemsSize;
        public int nbByLine;

        public override void FillDataStructure(CWidget wid)
        {
            CContainerLine w = wid as CContainerLine;
            base.FillDataStructure(wid);
            allowedTypes = new List<long>();
            foreach (long nb in w.AllowedTypes)
                allowedTypes.Add(nb);
            conserveAspect = w.ConserveAspect;
            elementsTexture = new CHudTextureData();
            elementsTexture.FillDataStructure(w.ElementsTexture);
            itemsSize = w.ItemsSize;
            nbByLine = w.NbByLine;
        }

        public override void FillFromDataStructure(ref CWidget wid, CHUDSystem hud)
        {
            base.FillFromDataStructure(ref wid, hud);
            foreach (long l in allowedTypes)
                (wid as CContainerLine).AllowedTypes.Add(l);
            (wid as CContainerLine).ConserveAspect = conserveAspect;
            CHudTexture tex = new CHudTexture();
            elementsTexture.FillFromDataStructure(tex);
            (wid as CContainerLine).ElementsTexture = tex;
            (wid as CContainerLine).ItemsSize = itemsSize;
            (wid as CContainerLine).NbByLine = nbByLine;
        }
    }
}
